package DecertifiSys.untill.baseUntill;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by zhoumeineng on 2018/1/31.
 */
public class AllTokenBring {

    public static String loginTokenBring(String string){
        try {
            MessageDigest digest = MessageDigest.getInstance("md5");
            byte[] bytes = digest.digest(string.getBytes());
            StringBuffer buffer = new StringBuffer();
            for (byte b : bytes) {
                int number = b & 0xff;
                String str = Integer.toHexString(number);
                if (str.length() == 1) {
                    buffer.append("0");
                }
                buffer.append(str);
            }
            string = buffer.toString();

        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return string;
    }
}
